Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git] / 11470 - Square sums / 11470.cpp
blob8586137dc7c114f89ac05e52d94fc9be027d7e6a
1 #include <iostream>
3 using namespace std;
5 const int SIZE = 10;
7 int g[SIZE][SIZE];
9 int main(){
10 int n, C = 1;
11 while(scanf("%d", &n) == 1 && n){
12 for (int i=0; i<n; ++i){
13 for (int j=0; j<n; ++j){
14 scanf("%d", &g[i][j]);
18 printf("Case %d:", C++);
19 for (int i=0; i<(n/2); ++i){
20 //printf("\ni es: %d\n", i);
21 int s = 0;
22 for (int j=i; j<=n-1-i; ++j){
23 s += g[i][j];
24 s += g[n-1-i][j];
26 for (int k=i+1; k<n-1-i; ++k){
27 s += g[k][i] + g[k][n-1-i];
29 printf(" %d", s);
31 if (n & 1) printf(" %d", g[n/2][n/2]);
32 puts("");
34 return 0;